Ext.define('Admin.view.overtimeapprove.OvertimeApproveGrid', {
    extend: 'Ext.grid.Panel',
    id: 'overtimeApproveGrid',
    xtype: 'overtimeApproveGrid',

    requires: [
        'Ext.button.Segmented',
        'Ext.list.Tree'
    ],

    title: '待审批的加班申请',

    layout: 'fit',
    defaults: {
        anchor: '80%'
    },


    scrollerble: true,
    bind: '{overtimeApproveFormLists}',
    columns: [
        { text: '申请人', dataIndex: 'name', width: 60, sortable: true },
        { text: '所属部门', dataIndex: 'department', width: 100, sortable: true },
        { text: '申请时间', dataIndex: 'applicationTime', width: 150, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') },
        { text: '开始时间', dataIndex: 'beginDate', width: 180, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') },
        { text: '结束时间', dataIndex: 'endDate', width: 180, sortable: true, renderer: Ext.util.Format.dateRenderer('Y/m/d H:i:s') },
        { text: '加班时长', dataIndex: 'totalTime', width: 75, sortable: true },
        { text: '加班原因', dataIndex: 'reason', sortable: true },
        { text: '状态', dataIndex: 'state', width: 100, sortable: true },
        {
            text: '操作',
            xtype: 'actioncolumn',
            items: [{
                xtype: 'button',
                iconCls: 'x-fa fa-pencil',
                tooltip: '签收',
                getClass: function (v, meta, rec) {
                    if (rec.get('assignee') != '') {
                        return 'x-hidden';
                    }
                    return 'x-fa fa-pencil';
                },
                handler: 'overtimeTaskClime'
            }, {
                xtype: 'button',
                iconCls: 'x-fa fa-pencil',
                tooltip: '审批',
                getClass: function (v, meta, rec) {
                    if (rec.get('assignee') == '') {
                        return 'x-hidden';
                    }
                    return 'x-fa fa-hand-paper-o';
                },
                handler: 'openOvertimeApproveFormWindow'
            }]
        }
    ],

    bbar: Ext.create('Ext.PagingToolbar', {
        bind: '{overtimeApproveFormLists}',
        displayInfo: true,
        displayMsg: '显示第 {0} - {1} 条数据 总计 {2}',
        emptyMsg: "没有任何数据",

    })
});
